#include "v4l2.h"
#include <QApplication>
#include <QPixmap>
#include <QSplashScreen>
#include <QProgressBar>

#define OPENPAGE_PATH   "/mnt/myusb/openpage.bmp"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QPixmap pixmap(OPENPAGE_PATH);
    QSplashScreen splash(pixmap);
    /* 进度条 */
    QProgressBar progressBar(&splash);
    progressBar.setRange(0,100);
    progressBar.setGeometry(90, 1700, 900, 72);
    progressBar.setStyleSheet("QProgressBar {"
                              "font:40px;"
                              "text-align: center;"
                              "}"
                              "QProgressBar::chunk {"
                              "background-color: rgba(0, 255, 0, 100%);"
                              "}");

    splash.show();      /* 显示启动界面 */
    /* 延时处理 */
    QDateTime relaytime = QDateTime::currentDateTime();
    QDateTime currenttime;
    do
    {
        currenttime = QDateTime::currentDateTime();
        progressBar.setValue(relaytime.secsTo(currenttime) / 5.0 * 100);
        QCoreApplication::processEvents();
    }
    while(relaytime.secsTo(currenttime) <= 5);

    v4l2 w;
    splash.finish(&w);
    w.show();           /* 显示软件界面 */
    return a.exec();
}
